<?php
class CataloguesController extends AppController {
    
public $uses = array('UsersTricksTip','Trick','TricksTypesSpin');

public function view($TrickId=null) {
    
    
    if(isset($TrickId))  {
        if (!empty($this->request->data)){
            $data = $this->request->data;
            $data['UsersTricksTip']['users_id'] = $this->getCurrentUserId();
            $data['UsersTricksTip']['tricks_id'] = $TrickId;
            $data = $this->UsersTricksTip->save($data);
        }
        
        $this->set('TrickId', $TrickId);
        $this->set('data',$data);
        $tip = $this->UsersTricksTip->find('all',array('recursive' => -1));
        $this->set('tip',$tip);
        $trick = $this->Trick->find('first',array('conditions' => array('Trick.id' => $TrickId)));
        
        $this->set('trick',$trick);
    }
    
}
}
?>
    